<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>商家鼓励金</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<link rel="stylesheet" href="../css/iconfont.css" />
		<link rel="stylesheet" href="../css/wallet.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		    <h1 class="mui-title">商家鼓励金</h1>
		</header>
		<div class="mui-content record_content">
			<ul class="record_nav clearfix">
				<li class="left">名称</li>
				<li class="center" style="width: 15%;margin-left:15%;">鼓励金</li>
				<li class="right" style="width: 20%;">剩余鼓励金</li>
			</ul>
		    <ul class="record_list2" id="yue_jilu">
		    	<!--<li class="add clearfix">
		    		<div class="left">
		    			<p class="list_nam">九鼎国际养殖场</p>
		    			<p class="list_time">2017/4/17</p>
		    		</div>
		    		<div class="center">＋66</div>
		    		<div class="right">20066</div>
		    	</li>-->
		    </ul>
		</div>
		<input type="hidden" id="cut_page" value="1" />
		<input type="hidden" id="total_num" value="1" />
		<input type="hidden" id="per_page" value="4" />
	</body>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>

<script type="text/javascript" src="../js/castapp.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>
<script type="text/javascript" src="../js/app.js"></script>
<script>
	//底部加载事件
	$(window).scroll(function() {
		if($(document).scrollTop()+1 >= $(document).height() - $(window).height()) {
			var total_num= $("#total_num").val();
			var per_page= $("#per_page").val();
			var page_total = Math.ceil(parseInt(total_num)/parseInt(per_page));
			var cut_page = $("#cut_page").val();
			
			if(cut_page<page_total){
				$("#cut_page").val(parseInt(cut_page) + 1);
			}else{
				layer.msg("已到底部");
			}
		}
	});

</script>
<script type="text/javascript">
	var member = JSON.parse(localStorage.getItem('member'));
	$.ajax({
		url: APP.api_url + 'Wallet/shop_score',
		data: {
			token: member['token'],		
			uid		: getUid(),
			sid		: getUrlParam('sid'),
			page	: $("#cut_page").val()
		},
		success: function(data) {
			if(data.code == 200) {
				var score_list = data.data;
				var yue_htm = "";
				for(var i = score_list.length-1; i >= 0; i--) {
					yue_htm +='<li class="add clearfix">'+
						    		'<div class="left">'+
						    			'<p class="list_nam">'+score_list[i].message+'</p>'+
						    			'<p class="list_time">'+score_list[i].add_time+'</p>'+
						    		'</div>'+
						    		'<div class="center" style="width: 15%;margin-left:15%;">'+score_list[i].score+'</div>'+
						    		'<div class="right" style="width: 20%;">'+score_list[i].balance+'</div>'+
						    	'</li>';
			    	
				}
				$("#yue_jilu").empty();
				$("#yue_jilu").append(yue_htm);
				
				$("#total_num").val(data.data.total);
				$("#per_page").val(data.data.per_page);
			} else {
				console.log(data.msg);
			}	
		}
	})
			
</script>
